<div ng-controller="OrderCtrl" ng-init="listAction()">
    <ul class="sui-breadcrumb">
        <li><a href="#/order/list">{{'Order'| translate}}</a></li>
        <li class="active">
            {{"List"|translate}}
            <!-- <a href="#/order/add" id="addNew" class="sui-btn btn-primary">+{{'add_new' | translate}}</a> -->
        </li>
        <span class="sui-form sui-form pull-right">
			<!-- <store-list ng-model="store_id" dft="1" ng-show="false"></store-list> -->
			<input type="text" placeholder="{{'Orderid'|translate}}" ng-model="order_id">
			<input placeholder="{{'start time'|translate}}" datetimepicker ng-model="start_created">
			<input placeholder="{{'end time'|translate}}" datetimepicker min-date="{{start_created}}" ng-model="end_created">
			<pickpoint-list ng-model="pickpoint_id" dft="0"></pickpoint-list>
            
            <span ng-show="member_id">
                <wxinfo ng-model="member_id" stye="1" is-url="1"></wxinfo>
                <button type="button" class="sui-btn btn-small  btn-danger" ng-show="member_id" ng-click="member_id=0"> X</button>
            </span>
        <chose-member member-check="memberdata1(memberInfo)" title="选择用户" app="1"></chose-member>

        <input type="text" placeholder="输入收货人姓名" ng-model="deliver_name">
        <input type="text" placeholder="输入收货人手机号" ng-model="deliver_phone">
        <button class="sui-btn btn-primary" type="submit" ng-click="getorderList(1)">{{'search'|translate}}</button>
        <export-data startcreated="start_created" endcreated="end_created" orderid="order_id" chosedstatus="chosedStatus" memberid="member_id" pickpointid="pickpoint_id"></export-data>
        </span>
    </ul>
    <div class="sui-row-fluid">
        <settlement-tab ng-model="chosedStatus" click-tab="getorderList(1)"></settlement-tab>
        <div ng-show="chosedStatus == 'S_ORDER_WAIT_DELIVERY' && orderslist.length" style="margin-bottom: 10px">
            <order-deliver-goods backcall="getorderList()"></order-deliver-goods>
        </div>
        <table class="sui-table table-bordered">
            <thead>
                <tr>
                    <th>{{'#'|translate}}</th>
                    <!-- <th>{{'用户昵称'|translate}}</th> -->
                    <th>{{'订单商品'|translate}}</th>
                    <th>{{'订单信息'|translate}}</th>
                    <th>{{'金额'|translate}}</th>
                    <!-- <th>{{'包装费'|translate}}</th>
                    <th>{{'运费'|translate}}</th>
                    <th>{{'税费'|translate}}</th>
                    <th>{{'支付金额'|translate}}</th> -->
                    <!-- <th>{{'time'|translate}}</th> -->
                    <th>{{'收货人'|translate}}</th>
                    <!-- <th>{{'创建时间'|translate}}</th> -->
                    <th>{{'operation'|translate}}</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="(key, list) in orderslist">
                    <td>
                        <input type="checkbox" name="fhmoder" checklist-model="$parent.fhmoder" checklist-value="list">
                    </td>
                    <!-- <td style="width: 60px;">
                        <wxinfo ng-model="list.member_id" stye="1"></wxinfo>
                    </td> -->
                    <td>
                        <table class="sui-table table-bordered">
                            <tr>
                                <td>{{'主图'|translate}}</td>
                                <td>{{'title'|translate}}</td>
                                <td>{{'数量'|translate}}</td>
                                <td>{{'关联组合装'|translate}}</td>
                            </tr>
                            <tr ng-repeat="item in list.items">
                                <td style="width:60px;">
                                    <a href="#/item/add?id={{item.item_id}}"><img ng-src="{{item.image}}" width="60"></a>
                                </td>
                                <td>
                                    <span style="display: block;word-wrap:break-word">{{item.title}}</span><br />
                                    <b>{{ item.sku_properties | skuname }}</b><br />
                                    <b title="外部编码">
                                        <button ng-show="item.sku_outer_id" class="btn" ngclipboard data-clipboard-text="{{item.sku_outer_id}}" ngclipboard-success="onSuccess(e,this);">
                                            {{item.sku_outer_id}}
                                        </button>
                                    </b>
                                    <br />
                                    <b title="条码">
                                        <button ng-show="item.barcode" class="btn" ngclipboard data-clipboard-text="{{item.barcode}}" ngclipboard-success="onSuccess(e,this);">
                                            {{item.barcode}}
                                        </button>
                                    </b>
                                </td>
                                <td>{{item.quantity}}</td>
                                <td>
                                    <sku-item-list skuid="{{ item.sku_id}}"></sku-item-list>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td style="width: 180px;">
                        <!-- <div>
                            <wxinfo ng-model="list.member_id" stye="1"></wxinfo>
                        </div> -->
                        <marking-info flag="list.flag" remark="list.remark" order-id="list.order_id"></marking-info>
                        <br />
                        <button class="btn" ngclipboard data-clipboard-text="{{list.order_id}}" ngclipboard-success="onSuccess(e,this);">
                            {{list.order_id}}
                        </button>
                        <br />
                        <span>创建时间：{{list.created_at | ddtt}}</span>
                        <br />
                        <span ng-show="list.paid_time">
                            支付时间：{{list.paid_time | ddtt}}
                        </span>
                        <div class="sui-msg msg-tips">
                            <div class="msg-con">{{list.profit_status == 1?"分账订单":"正常订单"}}</div>
                            <s class="msg-icon"></s>
                        </div>
                        <div class="sui-msg msg-tips" ng-show="list.pay_way_code == 1 || list.pay_way_code == 2 || list.pay_way_code == 16 || list.pay_way_code == 20">
                            <div class="msg-con" ng-show="list.pay_way_code == 1">微信支付</div>
                            <div class="msg-con" ng-show="list.pay_way_code == 2">余额支付</div>
                            <div class="msg-con" ng-show="list.pay_way_code == 16">银联支付</div>
                            <div class="msg-con" ng-show="list.pay_way_code == 20">新生支付</div>
                            <s class="msg-icon"></s>
                        </div>
                        <div ng-show="list.order_type==4" style="margin-top: 5px;">
                            <pt-schedule ng-show="list.items[0].pintuan_activity_id" ng-model="list.items[0].pintuan_activity_id"></pt-schedule>
                        </div>

                        <div ng-show="list.receiver_time !='0001-01-01 08:00:00'">
                            {{!list.deliver_name?"自提时间":"配送时间"}}：{{list.receiver_time | ddtt}}
                        </div>

                        <div class="sui-msg msg-tips">
                            <div class="msg-con">
                                <order-status ng-model="list.status" stype="1"></order-status>
                            </div>
                            <s class="msg-icon"></s>
                            <div ng-if="list.pickpoint_id">
                                <order-hg-status order-id="list.order_id"></order-hg-status>
                            </div>
                        </div>

                        <div ng-show="list.food_id">
                            餐桌号:{{list.food_id}}
                        </div>
                    </td>
                    <td style="width: 70px;">
                        订单金额：{{list.fuhao}}{{list.total_fee}}<br/>优惠：{{list.fuhao}}{{list.discount_fee}} <br /> 包装费：{{list.fuhao}}{{list.packing_fee}} <br /> 物流费：{{list.fuhao}}{{list.post_fee}} <br /> 税费：{{list.fuhao}}{{list.total_tax}} <br /> 支付金额：{{list.fuhao}}{{list.payment}}
                        <span ng-show="list.coupon_fee">(包含优惠:{{list.coupon_fee}}元)</span>
                    </td>
                    <!-- <td>{{list.fuhao}}{{list.packing_fee}}</td>
                    <td>
                        {{list.fuhao}}{{list.post_fee}}
                    </td>
                    <td>
                        {{list.fuhao}}{{list.total_tax}}
                    </td>
                    <td style="width: 70px;">
                        {{list.fuhao}}{{list.payment}}
                        <span ng-show="list.coupon_fee">(包含优惠:{{list.coupon_fee}}元)</span>
                    </td> -->
                    <td>
                        <buyerlist order_id="list.order_id" order="list"></buyerlist>
                        <br /> {{list.deliver_phone}}
                        <br />
                        <span style="display: block;width: 100px;word-wrap:break-word">{{list.province}} {{list.city}}
							{{list.district}} {{list.deliver_address}}</span>
                        <hr /> 顾客备注：{{list.note}}
                    </td>
                    <!-- <td>{{list.created_at | ddtt}}</td> -->
                    <td style="width: 160px;">
                        <marking title="订单打标" order-id="list.order_id" up-flag="upflagback()"></marking>

                        <button ng-click="statusup(list.order_id,3,$event,list,1)" ng-show="list.status == 'S_ORDER_WAIT_CONFIRM' " class="sui-btn btn-success">订单确认</button>
                        <a href="#/order/info?order_id={{list.order_id}}" class="sui-btn btn-primary">{{'info'|translate}}</a>
                        <span ng-show="list.status == 'S_ORDER_WAIT_PAYMENT'">
							<update-payment orderid="{{list.order_id}}" backcall="getorderList()"></update-payment>
						</span>
                        <a ng-show="list.status == 'S_ORDER_WAIT_DELIVERY' " href="#/order/delivery?order_id={{list.order_id}}" class="sui-btn btn-success">订单发货</a>
                        <br>
                        <pickpoint-info ng-model="list.pickpoint_id"></pickpoint-info>
                        <br />
                        <update-order-pickpoint ng-show="list.status == 'S_ORDER_WAIT_CONFIRM' || list.status == 'S_ORDER_WAIT_DELIVERY'" title="修改发货点" member-check="backpickpoint(pickpoint)" chosed-pid="list.pickpoint_id" order-id="list.order_id"></update-order-pickpoint>
                        <br/>
                        <div ng-show="list.status !== 'S_ORDER_WAIT_PAYMENT' && list.status !== 'S_ORDER_COMPLETED' && list.status !=='S_ORDER_WAIT_RATE' && list.status !=='S_ORDER_ALREADY_REFUNDED' && list.status !=='S_ORDER_CANCEL' && list.status!='S_ORDER_WAIT_RECEIVE' && list.status!='S_ORDER_AFTER_SERVICE'">
                            <print-order orderid="list.order_id" type="item"></print-order>
                            <span ng-show="list.pickpoint_id"> 
								<button ng-show="industryCode=='27'"  ng-click="postOrder(list.order_id,1)" class="sui-btn btn-success">推送订单</button>
								<button ng-show="industryCode=='28'" ng-click="postOrder(list.order_id,2)" class="sui-btn btn-success">推送订单到仓库</button>
								<button ng-show=" industryCode=='27' || industryCode=='28'"  ng-click="postPay(list.order_id)" class="sui-btn btn-warning">推送支付单</button>
                                
                                 <detailed-list order-id="list.order_id" pickpoint-id="list.pickpoint_id" type='4'></detailed-list>
                                 <detailed-list order-id="list.order_id" pickpoint-id="list.pickpoint_id" type='6'></detailed-list>
							</span>
                            <button ng-show="list.pickpoint_id && (list.status == 'S_ORDER_WAIT_DELIVERY') && industryCode ==27" ng-click="postWms(list.order_id)" class="sui-btn btn-danger">推送订单到仓库</button>
                        </div>
                        <button ng-show="list.store_id == '6026' && list.status == 'S_ORDER_ALREADY_REFUNDED'" ng-click="pushWmsMsg(list.order_id)" class="sui-btn btn-danger">通知仓库退单</button>
                        <button ng-show="list.store_id == '1' || (list.store_id == '6026' && list.status == 'S_ORDER_WAIT_DELIVERY')" ng-click="pushClearOrder(list.order_id)" class="sui-btn btn-primary">补推清单</button>
                    </td>
                </tr>
            </tbody>
        </table>
        <!-- 分页start -->
        <span ng-show="orderslist.length>1">
			<button ng-click="checkAll()" class="sui-btn btn-success">
				<span ng-show="idtype">全选</span><span ng-show="!idtype">反选</span>
        </button>
        <button ng-show="selectedOrderIds" class="sui-btn btn-info" ngclipboard data-clipboard-text="{{selectedOrderIds}}" ngclipboard-success="onSuccess(e,this);">
            <i class="sui-icon icon-tb-edit"></i> 复制订单编号
        </button>
        </span>
        <button ng-click="pilianfh($event,1,1)" class="sui-btn btn-warning" ng-show="selectedOrderIds && chosedStatus == 'S_ORDER_WAIT_CONFIRM' && orderslist.length ">批量订单确认</button>
        <span ng-show="chosedStatus == 'S_ORDER_WAIT_DELIVERY' && orderslist.length "> 
			<button ng-click="pilianfh($event,2,1)" class="sui-btn btn-danger" >批量无物流发货</button>
			<button ng-show="industryCode=='27'"  ng-click="pilianPost($event,1)" class="sui-btn btn-success">推送订单</button>
			<button ng-show=" industryCode=='27' || industryCode=='28'"  ng-click="pilianPost($event,2)" class="sui-btn btn-warning">推送支付单</button>
		</span>
        <pager page-no="{{pageNo}}" page-size="pageSize" total="ordersTotal" get-data="getorderList(pageNo)"></pager>
    </div>
    <!-- 分页end -->
</div>